<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2020/6/23
 * Time: 9:31
 */

namespace app\common\model\media;


use app\common\model\TimeModel;

class UserNet extends TimeModel
{
    protected $deleteTime = 'delete_time';

    //获取线下课程
    public function account(){
        return $this->belongsTo('App\Models\Account','net_id','id');
    }
    public static function onAfterInsert($data){

        //$self = new static();
        $article = self::withoutGlobalScope()->find($data->id);

        $article->withoutGlobalScope()->where('id',$data->id)->save(['app_id'=>self::get_appId()]);

    }
    //获取线上课程
    public function nets(){
        return $this->belongsTo('App\Models\Account','net_id','id');
    }
    /**
     * 定义全局的查询范围
     * @param \think\db\Query $query
     */
    public function scopeApp_id($query)
    {
        return true;

    }
}